<form action="{:U('event/add')}" method="post">
	<input type="hidden" name="creator_role_id" value="{$Think.session.role_id}"/>
	<input type="hidden" name="r" value="{$r}"/>
	<input type="hidden" name="module2" value="{$module2}"/>
	<input type="hidden" name="id" value="{$id}"/>
	<input type="hidden" name="dialog_add" value="dialog_add"/>
	<input type="hidden" name="refer_url" value="{$refer_url}"/>
	
	<table type="hidden" class="table table-hover">
		<tfoot>
			<tr>
				<td>&nbsp;</td>
				<td colspan="3"><input class="btn btn-primary" type="submit" name="submit" value="{:L('SAVE')}"/> &nbsp; <input class="btn" onclick="javascript:$('#dialog-event').dialog('close');" type="button" value="{:L('CANCEL')}"/></td>
			</tr>
		</tfoot> 
		<tbody>
			<tbody>
				<tr><th colspan="4">{:L('BASIC_INFO')}</th></tr>
					<tr>
						<td class="tdleft">{:L('THEME')}</td>
						<td <if condition="C('ismobile') neq 1">colspan="3"</if>><input type="text" name="subject" id="subject" class="span3"/></td>
					</tr>
					<tr>
						<td class="tdleft">{:L('OWNER_ROLE')}</td>
						<td>
							<input type="hidden" name="owner_role_id" id="event_owner_id" value="{:session('role_id')}"/>
							<input type="text" id="event_owner_name" name="owner_name" class="span3" value="{:session('name')}"/>
						</td>
						<if condition="C('ismobile') eq 1"></tr><tr></if>
						<td class="tdleft">{:L('PLACE')}</td>
						<td><input type="text" name="venue" class="span3"/></td>
					</tr>
					<tr>
						<td class="tdleft">{:L('START_TIME')}</td>
						<td><input type="text" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate:&quot;#F{$dp.$D('end_date')||'2020-10-01'}&quot;})" id="start_date" name="start_date" class="span1"/>
						</td>
						<if condition="C('ismobile') eq 1"></tr><tr></if>
						<td class="tdleft">{:L('END_TIME')}</td>
						<td><input type="text" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', minDate:&quot;#F{$dp.$D(\'start_date\')}&quot;,maxDate:'2020-10-01'})" id="end_date" name="end_date" class="span1"/>
					</tr>
					<tr>
						<td class="tdleft">{:L('DESCRIBE')}</td>
						<td <if condition="C('ismobile') neq 1">colspan="3"</if>>
							<textarea rows="6" class="span6" name="description"></textarea>
						</td>
					</tr>
				</tbody>
		</tbody>
	</table>
	</form>
<div id="dialog-event-role-list" class="hide" title="{:L('CHOICE_ACTIVITY')}">loading...</div>
<script type="text/javascript">
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>
$("#dialog-event-role-list").dialog({
	autoOpen: false,
	modal: true,
	width: width,
	maxHeight: 400,
	buttons: { 
		"{:L('OK')}": function () {
			var item = $('input:radio[name="owner"]:checked').val();
			var name = $('input:radio[name="owner"]:checked').parent().next().html();
			$('#event_owner_name').val(name);
			$('#event_owner_id').val(item);
			$(this).dialog("close"); 
		},
		"{:L('CANCEL')}": function () {
			$(this).dialog("close");
		}
	},
	position: ["center", 100]
});
	
$(function(){
	$('#event_owner_name').click(
		function(){
			$('#dialog-event-role-list').dialog('open');
			$('#dialog-event-role-list').load("{:U('user/listDialog')}");
		}
	);
	
});	
$(function(){
	$("input[name='submit']").click(function(){			
		if($("#subject").val() == null || $("#subject").val() == ""){
			alert('{:L('SUBJECT_CAN_NOT_EMPTY')}');
			return false;
		}
	})
	
});

</script>